#ifndef IMAGE_H
#define IMAGE_H
#include <QtOpenGL/qgl.h>
#include <QImage>
#include <windows.h>
#include <gl/gl.h>


struct TileRect;

struct Point
{
    int x, y;
};

struct Rect
{
    int x, y, w, h;
};

class Image
{
public:
    Image(QString name);
    Image();
    ~Image();

    void Load(QString name);
    void Render(int left = 0, int top = 0);

    Rect GetClipRect();
    QString& GetImageName() const;
    int GetX() const;
    int GetY() const;

    int GetWidth() const { return myWidth; }
    int GetHeight() const { return myHeight; }

    void SetClip(int x, int y, int w = 32, int h = 32)
    {

        myClip.x = x;
        myClip.y = myWidth - y-h;
        myClip.w = w;
        myClip.h = h;
    }

    void SetPosition(int x, int y)
    {
        myPos.x = x;
        myPos.y = y;
    }

private:
    Rect myClip;
    Rect myPos;
    GLuint m_texture;

    int myWidth, myHeight;

};

#endif // IMAGE_H
